Field of the Invention
The present invention relates to a technique for encoding image data on the basis of a coding system such as MPEG, H.264, or the like.
Description of the Background Art
Image data to be delivered on digital broadcasts, those to be stored in media such as DVDs (Digital Versatile Disks) and hard disks, and the like are compressed according to various coding systems. The object for such compressions of image data is to avoid constraint on a transmission band, increase the transmission rate, decrease the memory size, or the like.
For compression of image data, coding system such as MPEG, H.264, and the like are often used. In encoders for such coding system, a target value of the amount of codes (the target amount of codes) generated per unit time (1 picture or the like) is set in advance. The encoders perform code amount control so that the amount of codes of compressed image data generated per unit time (the amount of generated codes) may not exceed the target amount of codes.
In the code amount control, performed is feedback control based on a difference value between the target amount of codes and the amount of currently generated codes. If the amount of currently generated codes is larger than the target amount of codes, a quantization step value is set relatively coarse. If the amount of currently generated codes is smaller than the target amount of codes, a quantization step value is set fine. It is thereby possible to control the amount of codes so that the average amount of generated codes per long unit time (per second or the like) may become the target amount of codes.
In the above-discussed method for code amount control, however, the amount of generated codes per short unit time such as per GOP (Group of Picture), per picture, or the like becomes larger than the target amount of codes. In this case, there is a possibility that a destination buffer to which the compressed image data is transmitted may overflow and so on.
Japanese Patent Application Laid Open Gazette No. 2006-325239 discloses an encoder capable of suppressing the amount of codes per short unit time to the target amount of codes. In the encoder, a plurality of macroblocks of an input image signal is quantized by n quantizers in which different quantization step values are set. The encoder performs variable length coding of the plurality of macroblocks quantized with the respective quantization step values, to thereby detect the amount of codes of the plurality of macroblocks by the quantization step value. The encoder determines the combination of the quantization step values for the plurality of macroblocks so that the amount of codes of a picture may be most approximated to the target amount of codes of the picture.
When the input image signal is encoded by the method described in Japanese Patent Application Laid Open Gazette No. 2006-325239, however, the amount of computation becomes enormous. For this reason, it is difficult to perform encoding of the input image signal in real time.